#ifdef __cplusplus
extern "C"{
#endif

#ifndef __XS_HEAP_H__
#define __XS_HEAP_H__


typedef struct __xs_heap
{
    void** data;
    int a;      /* all data count */
    int n;      /* used data count */
    int (*cmp)(const void*, const void*); /* compare */
} xs_heap_t;

xs_heap_t* xs_heap_create(int size, int(*cmp)(const void*, const void*));

void xs_heap_destroy(xs_heap_t* heap);

int xs_heap_add(xs_heap_t* heap, void* value);

void* xs_heap_del(xs_heap_t* heap, int index);

int xs_heap_empty(xs_heap_t* heap);

#endif
#ifdef __cplusplus
}
#endif

